package com.teradata.fbj.util;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

import org.springframework.stereotype.Component;

@Component("freeJDBC")
public class freeJDBC {

		public void free(ResultSet rs,PreparedStatement ps, Connection conn){
			try {
	            if (rs != null) {
	                rs.close(); // 关闭结果集
	            }
	        } catch (SQLException e) {
	            e.printStackTrace();
	        } finally {
		               try {
							if(ps != null){
								ps.close();
							}
						} catch (SQLException e) {
							e.printStackTrace();
						}finally{
							 try {
				                    if (conn != null) {
				                        conn.close(); // 关闭连接
				                    }
				                } catch (SQLException e) {
				                    e.printStackTrace();
				                }
						}
	        	}
	        }
}
